import wx

class Example(wx.Frame):
    def __init__(self, parent, title):
        super(Example, self).__init__(parent, title=title, size=(350,250))
        self.InitUI()
    def InitUI(self):
        panel = wx.Panel(self)
        panel.SetBackgroundColour('red')
        vbox = wx.BoxSizer(wx.VERTICAL)
        midPan = wx.Panel(panel)
        midPan.SetBackgroundColour('green')
        vbox.Add(midPan, wx.ID_ANY, wx.EXPAND|wx.ALL, 20)
        panel.SetSizer(vbox)

def main():
    app = wx.App()
    frame = Example(None, title='BoxSizer demo')
    frame.Show()
    app.MainLoop()

if __name__ == '__main__':
    main()
